<?php

class ExtraFunctions {

function writeNumberOfItems($firstValue, $lastValue){
	$html = "<div class=\"extraFunction\">\n";
	$html .= "<p>Amount Of Items</p>\n";
	$html .= "<select name=\"amountOfItems\">\n";
	for ($i=$firstValue; $i<=$lastValue; $i++){
	$html .= "<option value=\"".$i."\">".$i."</option>\n";
	}
	$html .= "</select>\n";
	$html .= "</div>";
	return $html;
}

function foodItems($foodlist){
	$foodArray = explode(',',$foodlist);
	$html = "<div class=\"extraFunction\">\n";
	$html .= "<p>Items</p>\n";
	$html .= "<select name=\"foodItems\">\n";
	for ($i=0; $i<count($foodArray); $i++){
	$html .= "<option value=\"".strtolower($foodArray[$i])."\">".$foodArray[$i]."</option>\n";
	}
	$html .= "</select>\n";
	$html .= "</div>";
	return $html;
}

function writeDays(){
	$html = "<div class=\"extraFunction\">\n";
	$html .= "<p>Choose The Day</p>\n";
	$html .= "<select name=\"themeDays\">\n";
	$html .= "<option value=\"Monday\">Monday</option>\n";
	$html .= "<option value=\"Tuesday\">Tuesday</option>\n";
	$html .= "<option value=\"Wednesday\">Wednesday</option>\n";
	$html .= "<option value=\"Thursday\">Thursday</option>\n";
	$html .= "<option value=\"Friday\">Friday</option>\n";
	$html .= "</select>\n";
	$html .= "</div>";
	return $html;
}


function writeOwnWords(){
	$html = "<div class=\"extraFunction\">\n";
	$html .= "<p>Enter Your Instructions</p>\n";
	$html .= "<p>Please put in your own instructions/Directions, in no more than 12 words</p>\n";
	$html .= "<input name=\"vendingWords\" id=\"vendingWords\" size=\"30\"/>\n";
	$html .= "</div>";
	return $html;
}

function addOwnPrice(){
	$html = "<div class=\"extraFunction\">\n";
	$html .= "<p>Enter Your Instructions</p>\n";
	$html .= "<p>Write the saving here</p>\n";
	$html .= "<input name=\"ownPriceWords\" id=\"ownPriceWords\" size=\"30\"/>\n";
	$html .= "</div>";
	return $html;
}


function happyHours(){
 	$html = "<div class=\"extraFunction\">\n";
	$html .= "<p>Happy Hours</p>\n";
	$html .= "<select name=\"happyHourTimes\">\n";
	$html .= "<option value=\"0800-0900\">08.00 - 09.00</option>\n";
	$html .= "<option value=\"0900-1000\">09.00 - 10.00</option>\n";
	$html .= "<option value=\"1000-1100\">10.00 - 11.00</option>\n";
	$html .= "<option value=\"1100-1200\">11.00 - 12.00</option>\n";
	$html .= "<option value=\"1200-1300\">12.00 - 13.00</option>\n";
	$html .= "<option value=\"1400-1500\">14.00 - 15.00</option>\n";
	$html .= "<option value=\"1500-1600\">15.00 - 16.00</option>\n";
	$html .= "<option value=\"1600-1500\">16.00 - 17.00</option>\n";
	$html .= "</select>";
    $html .= "</div>";
    return $html;
}

function writeTimes($title, $name, $startHour, $startMin, $endHour, $endMin, $interval){
	$ts = mktime($startHour,$startMin,0);
 	$html = "<div class=\"extraFunction\">\n";
	$html .= "<label>$title</label>\n";
	$html .= "<select name=\"".$name."\">\n";
	$endTS = mktime($endHour,$endMin,0);
	while ( $endTS >= $ts ) {
	$html .= "<option value=\"".date("H.i",$ts)."\">".date("H.i",$ts)."</option>\n";
	$ts = $ts + $interval;
	};
	$html .= "</select>\n";
	$html .= "</div>";
	return $html;
}

function pricePoint($startPrice, $endPrice, $interval){
	$html = "<div class=\"extraFunction\">\n";
	$html .= "<p>Price Point</p>\n";
	$html .= "<select name=\"mealDealPrices\">\n";
	while($endPrice >= $startPrice){
	if($startPrice < 1.00){
	$startPrice = number_format($startPrice,2);
	$startPriceArray = explode(".",$startPrice);
	$html .= "<option value=\"0.".$startPriceArray[1]."\">".$startPriceArray[1]."p</option>\n";
	}else{
	$html .= "<option value=\"".$startPrice."\">&pound;".number_format($startPrice,2)."</option>\n";
	}
	$startPrice = $startPrice+$interval;
	}
	$html .= "</select>\n";
    $html .= "</div>";
    return $html;
}

function discountTable($file, $fileType = NULL){
	$html = "<div class=\"extraFunction\">\n";
	$html .= "<p>Discount Calculator</p>\n";
	$html .= "<p><a href=\"downloads/".$file."\">Download your Discount Calculator here.</a></p>\n
			 <p>This ".$fileType." document will enable you to calculate the maximum discount to offer to customers.</p>\n
			 <p>It also contains important information about how to ring this promotion through the tills</p>\n";
    $html .= "</div>";
    return $html;
}

function writeDropdownText(){
	$html = "<div class=\"extraFunction\">\n";
	$html .= "<p>Select Your Option</p>\n";
	$html .= "<p>Enter Your Facility Name</p>\n";
	$html .= "<input type=\"text\" id=\"facilityName\" name=\"facilityName\" size=\"30\">\n";
    $html .= "</div>";
    return $html;
}
}
?>